package com.nuotu.datawall.clouddata.util;

import com.github.abel533.echarts.Title;
import com.github.abel533.echarts.axis.CategoryAxis;
import com.github.abel533.echarts.axis.ValueAxis;
import com.github.abel533.echarts.code.Position;
import com.github.abel533.echarts.code.SeriesType;
import com.github.abel533.echarts.code.Trigger;
import com.github.abel533.echarts.code.X;
import com.github.abel533.echarts.json.GsonOption;
import com.github.abel533.echarts.series.Bar;
import com.github.abel533.echarts.series.Line;
import com.nuotu.datawall.clouddata.view.YAxis;

public class EColumnOptionUtil {

    public static GsonOption getColumnChartOptions(Object[] xAxis, Object[] yAxis) {
        GsonOption option = new GsonOption();
        option.grid().x(40).y(40).x2(40).y2(40);
        option.tooltip().trigger(Trigger.axis);
        YAxis valueAxis = new YAxis();
        valueAxis.axisLine().lineStyle().color("#0efcff");
        valueAxis.axisLabel().textStyle().fontSize(18);
        valueAxis.splitLine().show(false).lineStyle().color("#254E6A");
        valueAxis.minInterval(1);
        option.yAxis(valueAxis);

        CategoryAxis categorxAxis = new CategoryAxis();
        categorxAxis.data(xAxis);
        categorxAxis.axisLabel().textStyle().fontSize(18);
        categorxAxis.axisLine().lineStyle().color("#0efcff");
        option.xAxis(categorxAxis);
        Bar bar = new Bar();
        bar.barWidth(50);
        bar.type(SeriesType.bar).name("借阅量").data(yAxis).itemStyle()
                .normal()
//                .color("function(params){var colorList=[\"#C33531\",\"#EFE42A\",\"#64BD3D\",\"#64BD3D\",\"#64BD3D\"];return colorList[params.dataIndex]}")
                .textStyle().fontSize(30);
        bar.label().normal().show(true).position(Position.top).textStyle().fontSize(20).color("#0efcff");

//                .color("function(params){var colorList=["#C33531","#EFE42A","#64BD3D","#64BD3D","#64BD3D"];return colorList[params.dataIndex]}");;
        option.series(bar);
//        option.color("#3FB1E3","#626C91","#6BE6C1","#A0A7E6","#C4EBAD","#96DEE8");
        return option;
    }
}